using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;

public class Test2 : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        //GameObject obj =  AssetBundleManager.Instance.LoadSyncAssetBundle("cube","Cube") as GameObject;
        GameObject obj1 = HHHFramework.AssetBundleManager.Instance.LoadSyncAssetBundle("cube", "Cube",typeof(GameObject)) as GameObject;
        GameObject obj2 = HHHFramework.AssetBundleManager.Instance.LoadSyncAssetBundle<GameObject>("cube", "Cube");
        Instantiate(obj1);
        Instantiate(obj2);
    }

    #region string תType

    /// <summary>
    /// string תType
    /// </summary>
    /// <param name="typeName"></param>
    /// <returns></returns>
    public Type GetEnumType(string typeName)
    {
        Type type = null;
        Assembly[] assemblyArray = AppDomain.CurrentDomain.GetAssemblies();
        int assemblyArrayLength = assemblyArray.Length;
        for (int i = 0; i < assemblyArrayLength; ++i)
        {
            type = assemblyArray[i].GetType(typeName);
            if (type != null)
            {
                return type;
            }
        }

        for (int i = 0; (i < assemblyArrayLength); ++i)
        {
            Type[] typeArray = assemblyArray[i].GetTypes();
            int typeArrayLength = typeArray.Length;
            for (int j = 0; j < typeArrayLength; ++j)
            {
                if (typeArray[j].Name.Equals(typeName))
                {
                    return typeArray[j];
                }
            }
        }
        return type;
    }

    #endregion string תType
}
